Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix jest usage and add retry #2838

Merged
merged 4 commits into from
Nov 17, 2020
Merged

Conversation

ylemkimon
Copy link
Contributor

  • This is a bugfix
  • This is a feature
  • This is a code refactor
  • This is a test update
  • This is a docs update
  • This is a metadata update

For Bugs and Features; did you add new tests?

N/A

Motivation / Use-Case

  • Update jest to 26.6.3
  • Use jest-circus runner
  • Fix jest usages
  • Retry test three times for flaky tests, e.g., puppeteer

Breaking Changes

N/A

Additional Info

@codecov
Copy link

codecov bot commented Nov 16, 2020

Codecov Report

Merging #2838 (775d86c) into v4 (19b793f) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##               v4    #2838   +/-   ##
=======================================
  Coverage   93.04%   93.04%           
=======================================
  Files          39       39           
  Lines        1308     1308           
  Branches      348      348           
=======================================
  Hits         1217     1217           
  Misses         87       87           
  Partials        4        4           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19b793f...775d86c. Read the comment docs.

@@ -400,7 +400,7 @@ describe('Client console.log', () => {
})`;
options = { ...mode, ...options };
const testOptions = Object.assign({}, baseOptions, options);
await it(title, async (done) => {
await it(title, (done) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test functions cannot both take a 'done' callback and return something. Either use a 'done' callback, or return a promise.

});
server.close(done);
} else {
done();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done was not called if the server was null, causing Exceeded timeout of 20000 ms for a hook..

@@ -42,9 +42,7 @@ describe('https option', () => {
req.get('/').expect(200, /Heyo/, done);
});

afterAll(() => {
testServer.close();
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testServer.close requires a callback, causing TypeError: done is not a function.

@@ -9,34 +9,29 @@ jest.mock('os', () => {
});

describe('runBonjour', () => {
let mock;
let publish = jest.fn();
let unpublishAll = jest.fn();
Copy link
Contributor Author

@ylemkimon ylemkimon Nov 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variables referenced outside of jest.mock() now requires to be prefixed with mock.

@alexander-akait
Copy link
Member

Big thanks for helping

@alexander-akait alexander-akait merged commit 0a6feac into webpack:v4 Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants